﻿using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using LTJ.FrameWork;
using LTJ.Common;

namespace LTJ.WebPage.UserManage.infoset
{
    public partial class corpinfoset : UserPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void editcorp_Click(object sender, EventArgs e)
        {
            string mainstr = SASRequest.GetString("mainstr");
            companyinfo.cname = cname.Text;
            companyinfo.ecname = ecname.Text;
            companyinfo.relater = relater.Text;
            companyinfo.relateform = Utils.RemoveHtml(Utils.ChkSQL(relateform.Text));
            companyinfo.bio = Utils.RemoveHtml(Utils.ChkSQL(bio.Text));
            companyinfo.Mains = mainstr;
            companyinfo.Phone = phone.Text;
            companyinfo.WebUrl = weburl.Text;
            companyinfo.Email = email.Text;
            companyinfo.MSN = msn.Text;
            string logourl = FrameWorkUtil.SaveCorpLogo(companyinfo.id);
            if (logourl != "") companyinfo.logo = logourl;
            Companys.UpdateCompany(companyinfo);
            OpLogs.CreateCompanyOPLog(userinfo, SASRequest.GetIP(), LTJ.Entity.OpAction.CompanyInfoUpdate.ActionID, "");
            base.RegisterStartupScript("PAGE", "window.location.href='corpinfoset.aspx'");
        }

        #region Web 窗体设计器生成的代码

        override protected void OnInit(EventArgs e)
        {
            InitializeComponent();
            base.OnInit(e);
        }

        private void InitializeComponent()
        {
            editcorp.Click += new EventHandler(editcorp_Click);

            cname.Text = companyinfo.cname;
            ecname.Text = companyinfo.ecname;
            relater.Text = companyinfo.relater;
            relateform.Text = companyinfo.relateform;
            phone.Text = companyinfo.Phone;
            bio.Text = companyinfo.bio;
            email.Text = companyinfo.Email;
            msn.Text = companyinfo.MSN;
            weburl.Text = companyinfo.WebUrl;

            if (!OpAction(Entity.OprateAction.Update)) editcorp.Enabled = false;
        }

        #endregion
    }
}